import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: happyiu
 * Date: 2021-10-28
 * Time: 10:56
 */
public class TestDemo {
    public static void main1(String[] args) {
        System.out.println(1 + 2 * 3);
        //7  先计算了 2*3 , 再计算 1+

    }

    /*public static void main(String[] args) {
        int a = 5;
        int b = 10;
        int c = a+b;
    }*/


    public static void main2(String[] args) {
        System.out.println("111");
        System.out.println("222");
        System.out.println("333");
        //运行结果
        //111 222 333

    }

    public static void main3(String[] args) {
        int a = 5;
        if (a == 5) {
            System.out.println("a=" + a);
        }
    }

    public static void main4(String[] args) {
        int day = 5;
        if (day == 1) {
            System.out.println("今天周一！");
        } else if (day == 2) {
            System.out.println("今天周二！");
        } else if (day == 3) {
            System.out.println("今天周三！");
        } else if (day == 4) {
            System.out.println("今天周四！");
        } else if (day == 5) {
            System.out.println("今天周五！");
        } else {
            System.out.println("今天周末，出去wet！");
        }

    }

    public static int frogjump(int n) {
        if (n == 1 || n == 2) {
            return n;
        }
        int f1 = 1;
        int f2 = 2;
        int f3 = 0;
        for (int i = 3; i <= n; i++) {
            f3 = f1 + f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }

    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(frogjump(n));
    }

    public static int fbo(int n) {
        if (n == 1 || n == 2) {
            return n - 1;
        } else {
            return fbo(n - 1) + fbo(n - 2);
        }
    }

    public static void main6(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(fbo(n));
    }

    public static void move(char pos1, char pos2) {
        System.out.print(pos1 + " -> " + pos2 + " ");
    }

    public static void hanio(int n, char pos1, char pos2, char pos3) {
        if (n == 1) {
            move(pos1, pos3);
        } else {
            hanio(n - 1, pos1, pos3, pos2);
            move(pos1, pos3);
            hanio(n - 1, pos2, pos1, pos3);
        }
    }

    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        hanio(n, 'A', 'B', 'C');
        System.out.println();
    }

    public static int func(int n) {
        if (n < 10) {
            return n;
        } else {
            return func(n / 10) + n % 10;
        }
    }

    public static void main8(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(func(n));
    }

    public static void print(int n) {
        if (n < 10) {
            System.out.print(n + " ");
        } else {
            print(n / 10);
            System.out.print(n % 10 + " ");
        }
    }

    public static void main9(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        print(n);

    }

    public static int sumc(int n) {
        if (n == 1) {
            return n;
        } else {
            return sumc(n - 1) + n;
        }
    }

    public static void main10(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(sumc(n));
    }

    public static int funcc(int n) {
        if (n == 1) {
            return n;
        } else {
            return funcc(n - 1) * n;
        }
    }

    public static void main11(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(funcc(n));
    }

    public static int avg(int[] array) {
        int sum = 0;
        for (int i = 0; i < array.length; i++) {
            sum += array[i];
        }
        return sum;
    }

    public static void main12(String[] args) {
        int[] array = {1, 2, 3, 4, 5};
        System.out.println(avg(array));
    }

    public static void transform(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] *= 2;
        }
    }

    public static void main13(String[] args) {
        int[] array = {1, 2, 3, 4, 5};
        System.out.println("乘二前:");
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();
        transform(array);
        System.out.println("乘二后:");
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
    }

    public static void printArray(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
    }

    public static void main14(String[] args) {

        int[] array = {1, 2, 3, 4, 5, 6};
        printArray(array);
    }


    public static void init(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = i + 1;
        }
    }

    public static void main15(String[] args) {
        int[] array = new int[100];
        init(array);
        System.out.println(Arrays.toString(array));
    }

    public static void main16(String[] args) {
        int[] array = {1, 2, 3, 2, 1};
        int sum = array[0];
        for (int i = 1; i < array.length; i++) {
            sum = sum ^ array[i];
            //^上之后相同的互相消为0
        }
        System.out.println(sum);
    }

    public static void bbsort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            boolean flg = false;
            for (int j = 0; j < array.length - 1 - i; j++) {
                if (array[j] > array[j + 1]) {
                    int tmp = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = tmp;
                    flg = true;
                }
            }
            if (flg == false) {
                return;
            }
        }
    }

    public static void main17(String[] args) {
        int[] array = {1, 5, 4, 7, 8, 9, 3, 6, 2};
        System.out.println("排序前：");
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();
        System.out.println("排序后：");
        bbsort(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
    }

    public static boolean isUp(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            if (array[i] > array[i + 1]) {
                return false;
            }
        }
        return true;
    }

    public static void main18(String[] args) {
        int[] array = {1, 5, 4, 6, 7};
        System.out.println(isUp(array));
    }


    public static int binarySearch(int[] array, int key) {
        int left = 0;
        int right = array.length - 1;
        while (left <= right) {
            int mid = (left + right) / 2;
            if (array[mid] > key) {
                right = mid - 1;
            } else if (array[mid] < key) {
                left = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }

    public static void main19(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 6, 7, 8};
        System.out.println(Arrays.binarySearch(array, 7));
    }

    public static int[] copyArray(int[] array) {
        int[] copy = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            copy[i] = array[i];
        }
        return copy;
    }

    public static void main20(String[] args) {
        int[] array = {1, 2, 3, 5, 4};

        int[] copy = copyArray(array);
        System.out.println(Arrays.toString(copy));

    }

    public static String myToString(int[] array) {
        if (array == null) return "null";

        String str = "[";
        for (int i = 0; i < array.length; i++) {
            str = str + array[i];
            if (i != array.length - 1) {
                str = str + ", ";
            }
        }
        str = str + "]";
        return str;
    }


    public static void main21(String[] args) {
        int[] array = {1, 5, 3, 4, 2};
        System.out.println(Arrays.toString(array));
        System.out.println(myToString(array));
    }

    public static void main22(String[] args) {
        int year = 2000;
        if (year % 100 == 0) {
            // 判定世纪闰年
            if (year % 400 == 0) {
                System.out.println("是闰年");
            } else {
                System.out.println("不是闰年");
            }
        } else {
            // 普通闰年
            if (year % 4 == 0) {
                System.out.println("是闰年");
            } else {
                System.out.println("不是闰年");
            }
        }
    }

    public static void main23(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();

        if( (year % 100 != 0 && year % 4 == 0) || year % 400 == 0)
            System.out.println(year+"是闰年！");

        else
            System.out.println(year+"不是闰年！");

        scanner.close();
    }

    public static void main(String[] args) {
        int n = 5;
        switch(n){
            case 1:
                System.out.println("今天周一");
                break;
            case 2:
                System.out.println("今天周二");
                break;
            case 3:
                System.out.println("今天周三");
                break;
            case 4:
                System.out.println("今天周四");
                break;
            case 5:
                System.out.println("今天周五");
                break;
            default:
                System.out.println("今天周末，出去wet！");
        }
    }



}
